﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace ShevaEngine.Core.Modules.Materials
{
    /// <summary>
    /// Graphics material parameter.
    /// </summary>
    public class GraphicsMaterialParameterFloat : GraphicsMaterialParameter
    {
        /// <summary>Color.</summary>
        public Single Value;


        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="name"></param>
        public GraphicsMaterialParameterFloat()
            : base()
        {
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="name"></param>
        public GraphicsMaterialParameterFloat(string name, Single value)
            : base(name)
        {
            this.Value = value;
        }

        /// <summary>
        /// Method sets parameter.
        /// </summary>
        /// <param name="material"></param>
        public override void Set(GraphicsMaterial material)
        {
            material.Effect.Parameters[this.Name].SetValue(this.Value);
        }

        /// <summary>
        /// Is same.
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public override bool IsSame(GraphicsMaterialParameter parameter)
        {
            return base.IsSame(parameter) && this.Value == (parameter as GraphicsMaterialParameterFloat).Value;
        }
    }
}
